#include <func.h>

void atexitFunc1(void)
{
	printf("atexit function 1 called\n");
}

void atexitFunc2(void)
{
	printf("atexit function 2 called\n");
}

void onexitFunc(int exitStatus, void* arg)
{
	printf("on_exit function called: status=%d, arg=%ld\n", exitStatus, (long) arg);
}

int main(int argc, char* argv[]) {
	// 注册退出处理函数
	on_exit(onexitFunc, (void *) 10);
	atexit(atexitFunc1);
	atexit(atexitFunc2);
	on_exit(onexitFunc, (void *) 20);

	printf("Pragramming running...");
	sleep(3);

	// 退出进程
	// exit(2);
	// return 2;
	_exit(2);
}
